package io.seata.account.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.seata.account.entity.Account;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author ZengRJ
 */
public interface AccountMapper extends BaseMapper<Account> {

    @Update("update account_tbl set `money` = `money` - ${account.money} where user_id = #{account.userId}")
    int deduct(@Param("account") Account account);

    @Update("update account_tbl set `money` = `money` + ${account.money} where user_id = #{account.userId}")
    int refund(@Param("account") Account account);
}
